// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function updatePreview(prev_type,id) {
  if (typeof(t)!='undefined') {
    clearTimeout(t);
  }
  t = setTimeout("doUpdatePreview('"+prev_type+"','"+id+"')", 1000);
}
function doUpdatePreview(prev_type,id) {
  new Ajax.Updater(id+'_preview', '/'+prev_type+'/preview', {asynchronous:true, evalScripts:true, onComplete:function(request) {Element.hide(id+'_preview_spinner')}, onLoading:function(request) {Element.show(id+'_preview_spinner')}, parameters:'content=' + escape(document.getElementById(id+'_textarea').value)});    
}
cancelLink=false;